home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
language
/
elan1v5.arc
/
DEMO.ARC
/
RANTEST.E
< prev
next >
Wrap
Text File
|
1989-03-10
|
903b
|
44 lines
PROC put (REAL CONST a, INT CONST l):
put (text (text (a), l))
ENDPROC put;
PROC meanstd (INT CONST length, REAL VAR mean, std dev):
REAL VAR sum :: 0.0, sumsq :: 0.0;
INT VAR i;
FOR i UPTO length
REP
sum INCR x [i];
sumsq INCR x [i] * x [i]
ENDREP;
mean := sum / real (length);
std dev := sqrt ((sumsq - sum * mean) / real (length - 1))
ENDPROC meanstd;
program:
# Testing the randomgenerator #
put (" 0.5000 mean 0.2887 std dev");
line;
UPTO 19
REP
generate random sequence;
print its properties
ENDREP.
generate random sequence:
LET lgth = 100;
ROW lgth REAL VAR x;
INT VAR k;
FOR k FROM 1 UPTO lgth
REP x [k] := random
ENDREP.
print its properties:
line;
REAL VAR mean, std;
meanstd (lgth, mean, std);
put (mean, 9);
put (" ");
put (std, 9).
⇦